package simplescenegraph;

import simplescenegraph.math.Color4f;
import simplescenegraph.math.Vector3f;

public class PointLight extends SceneObject {
	
	private Color4f[] components = new Color4f[] { Color4f.black, Color4f.white, Color4f.white };	// ambient, diffuse and specular
	
	private float[] attenuationFactors = new float[] { 1, 0, 0 };  // constant, linear, quadratic 

	private boolean spot = false;
	
	private Vector3f direction = new Vector3f(0, 0, -1);
	
	private float cutoff = 90;
	
	private float exponent = 0;
	
	private boolean enabled = false;
	
	public void draw(Renderer renderer) {
		renderer.draw(this);
	}

	public boolean isSpot() {
		return spot;
	}

	public void setSpot(boolean spot) {
		this.spot = spot;
	}

	public Vector3f getDirection() {
		return direction;
	}

	public void setDirection(Vector3f direction) {
		this.direction = direction;
	}

	public float getCutoff() {
		return cutoff;
	}

	public void setCutoff(float cutoff) {
		this.cutoff = cutoff;
	}

	public float getExponent() {
		return exponent;
	}

	public void setExponent(float exponent) {
		this.exponent = exponent;
	}

	public Color4f[] getComponents() {
		return components;
	}
	
	public Color4f getAmbient() {
		return components[0];
	}
	
	public Color4f getDiffuse() {
		return components[1];
	}
	
	public Color4f getSpecular() {
		return components[2];
	}	

	public void setComponents(Color4f[] components) {
		this.components = components;
	}
	
	public float[] getAttenuationFactors() {
		return attenuationFactors;
	}

	public void setAttenuationFactors(float... fs) {
		this.attenuationFactors = fs;
	}
	
	public float getConstantAttenuationFactor() {
		return attenuationFactors[0];
	}
	
	public float getLinearAttenuationFactor() {
		return attenuationFactors[1];
	}
	
	public float getQuadraticAttenuationFactor() {
		return attenuationFactors[2];
	}
	
	public boolean isEnabled() {
		return enabled;
	}
	
	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}
	
}
 
